package com.hp.ongoing.app.view.form.contract;

import java.awt.event.KeyEvent;

@SuppressWarnings("serial")
public class JTextFieldOnlyNumbers extends JTextFieldPadrao {

	public JTextFieldOnlyNumbers() {
		super();
		addKeyListener(new java.awt.event.KeyAdapter() {
			@Override
			public void keyTyped(java.awt.event.KeyEvent evt) {
				jTextFieldKeyTyped(evt);
			}
		});
	}

	private void jTextFieldKeyTyped(KeyEvent evt) {
		String caracteres = "0987654321";
		if (!caracteres.contains(evt.getKeyChar() + "")) {
			evt.consume();
		}
	}

}
